package com.example.g3a1.fg

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import com.example.base.cons.mvvm.BaseFragment
import com.example.g3a1.R
import com.example.g3a1.adapter.NoticeAdapter
import com.example.g3a1.databinding.FragmentHomeBinding
import com.example.g3a1.notice.NoticeViewModel
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch

@AndroidEntryPoint
class HomeFragment : BaseFragment<FragmentHomeBinding, NoticeViewModel>() {
    val noticeAdapter by lazy { NoticeAdapter() }
    override fun initData() {

    }

    override fun initView() {
        lifecycleScope.launch {
            viewModel.getNotive().collect{
                noticeAdapter.submitData(it)
            }
        }

        binding.rvNotice.apply {
            adapter = noticeAdapter
            layoutManager = LinearLayoutManager(requireContext())
        }
    }

}